package com.kandinfo.base.admin.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kandinfo.base.admin.domain.Area;
import com.kandinfo.base.admin.service.AreaService;


@Controller
@RequestMapping(value="/area")
public class AreaController {
    
    @Autowired
    AreaService areaService;
    
    /**
     * 获取所有省份
     * @param areaId
     * @return
     */
 	@RequestMapping(value="/findAllProvince",method=RequestMethod.POST)
 	@ResponseBody
    public List<Area> findAllProvince(){
 		return areaService.findAllProvince();
    }
 	
    /**
     * 通过省份获取城市，通过城市获取区域等
     * @param areaId
     * @return
     */
 	@RequestMapping(value="/findArea/{areaId}",method=RequestMethod.POST)
 	@ResponseBody
    public List<Area> findArea(@PathVariable Long areaId){
 		return areaService.findByParent(areaId);
    }

 	
}
